$(function() {
	var grid;
	var url=null;
	var operation = {// 操作按钮  调取url
			addFun : rootPath + '/productaddvalue/addUI.shtml',
			editFun: rootPath + '/productaddvalue/editUI.shtml?id=',
			delFun : rootPath + '/productaddvalue/deleteEntity.shtml',
		}
	$.ajax({
		url:rootPath + '/productaddvalue/getButton.shtml',//请求获取按钮
		success:function(data){
			var button = data;
			$.post(rootPath + "/productaddvalue/property.shtml",function(data){
				//alert(data.replace('["', '[').replace('"]', ']'));
				var data = JSON.parse(data)
				data[data.length] = {
					colkey : "operation",
					name : "操作",
					"orderable": false,
					render:function(data,type,row,meta){
						if(button !== ''){
						  button = button.replace("\"","");
						  button = button.replace("\"","");
				        }
						return button;
					}
				}
				
				grid = TableData({
					gaine : 'paging',//id名
					table:'productaddvalue',
					column :data,
					url : rootPath + '/productaddvalue/findByPage.shtml',//表格数据请求地址
					//button: data,
					success:function(){
						 //将事件绑定在body上
						productaddvalue = function(e){
							    var e = e||window.event;
							    var target = $(e.target || e.srcElement);
							    //新增
							    if(target.hasClass('addFun')){
							    	cover._Body();//防止多次点击
							    	var id = target.parent().parent().attr('dataid');
							    	_click(operation.addFun,'addFun',id)
							    }
							    // 编辑
							    if(target.hasClass('editFun')){
							    	cover._Body();//防止多次点击
							    	var id = target.parent().parent().attr('dataid');
							    	_click(operation.editFun,'editFun',id)
							    }
							   //  删除
							    if(target.hasClass('delFun')){
							    	cover._Body();//防止多次点击
							    	var id = target.parent().parent().attr('dataid');
							    	_click(operation.delFun,'delFun',id)
							    }
						   }
						   $("#productaddvalue_wrapper").off("click", productaddvalue);
						   $("#productaddvalue_wrapper").on('click', productaddvalue);
					}
				 });
			})
			
		}
	})

});
	
	